<template>
  <div>
    <div>
      <!--条件筛选-->
      <FormPanel ref="formPanel" :list="formList" :cols="2" :labelWidth="110" :formType="type" :isSubmitBtn="false" @formChange="formChangeHandle" />
      <!-- <FilterTable
        ref="table"
        :columns="columns"
        :fetchapi="fetchApi"
        :params="fetchParams"
        :datakey="'rows'"
        :isSubmitBtn="false"
        :onColumnsChange="columns => (this.columns = columns)"
        :onRowSelectChange="selectChange"
        columnsRef="xkkhnewTable"
        selectionType="multiple"
      ></FilterTable> -->
    </div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <el-button @click="closeDialog">取 消</el-button>
      <el-button v-if="type !== 'show'" type="primary" @click="saveDialog">确定</el-button>
    </div>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
import TopFilter from '@/components/TopFilter';
import moment from 'moment';
export default {
  name: 'decorProduct',
  components: {},
  mixins: [dictionary],
  props: {
    type: {
      type: String,
      default: 'add'
    },
    rowData: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    this.saveData = null;
    return {
      formList: this.createFormList(),
      visibleProject: false,
      fetchParams: {}
    };
  },
  created() {
    // this.getlist();
  },
  methods: {
    createFormList() {
      return [
        {
          type: 'INPUT',
          label: '发货单号',
          fieldName: 'proCode',
          placeholder: '请输入...',
          rules: [{ required: true, message: '请输入发货单号', trigger: 'blur' }]
        },
        {
          type: 'DATE',
          label: '到货确认日期',
          fieldName: 'orderDate',
          initialValue: moment().format('YYYY-MM-DD'),
          disabled: false,
          rules: [{ required: true, message: '请选择到货确认日期', trigger: 'blur' }]
        }
      ];
    },

    closeHandler2(val, data) {
      this.formList.map(item => {
        item.initialValue = data[0][item.fieldName];
      });
      this.visibleProject = false;
    },
    formChangeHandle(val) {
      this.saveData = val;
    },
    saveDialog() {
      this.$refs.formPanel.SUBMIT_FORM();
      // if (this.saveData !== null) {
      //   this.saveData.bzName = this.workGroupData.find(item => item.WORKGROUP_CODE == this.saveData.bzCode).WORKGROUP_NAME;
      //   this.$emit('close3', false, this.saveData);
      // }
    },
    searchProjectCode() {
      this.visibleProject = true;
    },
    selectChange() {},
    // 搜索
    changeHandle(val) {
      console.log('打印了', val);
      this.fetchParams = Object.assign({}, val);
    },
    closeDialog() {
      this.visibleProject = false;
      this.$emit('close', false);
    }
  }
};
</script>

<style lang="less" scoped></style>
